<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="css/xadmin.css">
    <script src="lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/xadmin.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">演示</a>
            <a>
              <cite>导航元素</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">
                    更新日志
                </div>
                <div class="layui-card-body ">
                    <ul class="layui-timeline">
                        <li class="layui-timeline-item">
                            <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                            <div class="layui-timeline-content layui-text">
                                <table class="layui-table" id="logs" lay-filter="userLogs" lay-data="{toolbar: '#toolbarLogs',id:'Logs'}"></table>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use(['table','laydate'], function() {
        var table = layui.table;
        var laydate = layui.laydate;
        table.render({
            elem: '#logs'
            ,url:'/log/findLogsByPage'
            ,toolbar: true
            ,toolbar:'#toolbarLogs'
            ,title: '用户数据表'
            ,cols: [[
                {checkbox: true, fixed: true}
                ,{field:'id', title:'ID', width:60, fixed: 'left', unresize: true, sort: true, totalRowText: '合计行'}
                ,{field:'username', title:'用户名', width:80}
                ,{field:'operation', title:'用户操作', width:180}
                ,{field:'method', title:'请求方法', width:105,sort: true, totalRow: true}
                ,{field:'params', title:'请求参数', templet:"#buttonTpl", width:100, sort: true}
                ,{field:'time', title:'执行时间(毫秒)', width:130,sort: true, totalRow: true}
                ,{field:'ip', title:'ip地址', width:120, sort: true, totalRow: true}
                ,{field:'createdTime', title:'创建时间', width:180,sort: true,templet : '<div>{{ formatTime(d.createdTime,"yyyy-MM-dd hh:mm:ss")}}</div>' , totalRow: true}
            ]]
            ,page: true
            ,response: {
                statusName: 'code' //规定数据状态的字段名称，默认：code
                ,statusCode: 200 //规定成功的状态码，默认：0
                ,msgName: 'msg' //规定状态信息的字段名称，默认：msg
                ,countName: 'count' //规定数据总数的字段名称，默认：count
                ,dataName: 'data' //规定数据列表的字段名称，默认：data
            }

        });
    })
    // 格式化时间
    function formatTime(datetime, fmt) {
        if (datetime == null || datetime == 0) {
            return "";
        }
        if (parseInt(datetime) == datetime) {
            if (datetime.length == 10) {
                datetime = parseInt(datetime) * 1000;
            } else if (datetime.length == 13) {
                datetime = parseInt(datetime);
            }
        }
        datetime = new Date(datetime);
        var o = {
            "M+" : datetime.getMonth() + 1, // 月份
            "d+" : datetime.getDate(), // 日
            "h+" : datetime.getHours(), // 小时
            "m+" : datetime.getMinutes(), // 分
            "s+" : datetime.getSeconds(), // 秒
            "q+" : Math.floor((datetime.getMonth() + 3) / 3), // 季度
            "S" : datetime.getMilliseconds()
            // 毫秒
        };
        if (/(y+)/.test(fmt))
            fmt = fmt.replace(RegExp.$1, (datetime.getFullYear() + "")
                .substr(4 - RegExp.$1.length));
        for ( var k in o)
            if (new RegExp("(" + k + ")").test(fmt))
                fmt = fmt.replace(RegExp.$1,
                    (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k])
                        .substr(("" + o[k]).length)));
        return fmt;
    }
</script>
</html>